-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reset emoji suggestion pop-up automatically after an emoji has been inserted #27711
Conversation
Reviewer Checklist
Screenshots/VideosWebchrome-desktop-2023-09-19_14.32.24.mp4Mobile Web - Chromeandroid-chrome.mp4Mobile Web - Safariios-safari-2023-09-19_14.48.44.mp4Desktopmac-desktop-2023-09-19_14.45.23.mp4iOSios-native-2023-09-19_15.40.26.mp4Androidandroid-native.mp4 |
// Reset emoji suggestions when an emoji is replaced. | ||
// Important when emoji is replaced and the selection is not changed, more info issue #27156 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Reset emoji suggestions when an emoji is replaced. | |
// Important when emoji is replaced and the selection is not changed, more info issue #27156 | |
// Ensure emoji suggestions are hidden even when the selection is not changed (so calculateEmojiSuggestion would not be called). |
I think we can make this comment a bit more concise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
@@ -185,6 +185,12 @@ function ComposerWithSuggestions({ | |||
setIsCommentEmpty(!!newComment.match(/^(\s)*$/)); | |||
setValue(newComment); | |||
if (commentValue !== newComment) { | |||
// Reset emoji suggestions when an emoji is replaced. | |||
// Important when emoji is replaced and the selection is not changed, more info issue #27156 | |||
if (suggestionsRef.current) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we should also have !_.isEmpty(emojis)
as a condition here? I guess it's possible that in future newComment
might not only be changed by emoji replacements, so might be worth future-proofing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess it's possible that in future newComment might not only be changed by emoji replacements
@jjcoffee
I agree about that, but I think !_.isEmpty(emojis)
will not be useful in this case because emojis
it returns all emoji in the text not only the current replaced emojis.
For example: text with emoji πποΈ then many lines of text then cursor at the end writing normal letters not emoji
will return emojis = [π, ποΈ]
newComment
now in the code refer to comment after replace emoji.
So I think If new replacement applied in the future, in this time the fix should be if (commentValueWithEmoji !== commentValueWithoutEmoji)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ahmedGaber93 Ah yes I see what you mean, that makes sense. Let's leave it for now then!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
@ahmedGaber93 can you update the PR title to reflect the code changes in this PR? |
@MariaHCD Updated. |
@ahmedGaber93 I think your PR title should describe what the PR is doing instead of describing what it fixes. I updated the title, let me know if you think it should be different! |
π Deployed to staging by https://github.com/MariaHCD in version: 1.3.72-1 π
|
π Deployed to production by https://github.com/thienlnam in version: 1.3.72-11 π
|
π Deployed to staging by https://github.com/MariaHCD in version: 1.3.74-0 π
|
π Deployed to production by https://github.com/chiragsalian in version: 1.3.74-3 π
|
Details
Fixed Issues
$ #27156
PROPOSAL: #27156 (comment)
Tests
Offline tests
N/A.
QA Steps
Same as Tests step.
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)/** comment above it */
this
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Web
Screen.Recording.2023-09-18.at.9.18.58.PM.mov
Mobile Web - Chrome
Screen.Recording.2023-09-18.at.9.50.20.PM.mov
Mobile Web - Safari
Screen.Recording.2023-09-18.at.8.31.27.PM.mov
Desktop
Screen.Recording.2023-09-18.at.10.42.29.PM.mov
iOS
Screen.Recording.2023-09-18.at.8.29.11.PM.mov
Android
Screen.Recording.2023-09-18.at.10.15.58.PM.mov